<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <?php foreach ($css_files as $file): ?>
            <link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
        <?php endforeach; ?>
        <?php foreach ($js_files as $file): ?>
            <script src="<?php echo $file; ?>"></script>
        <?php endforeach; ?>
        <style type='text/css'>
            body
            {
                font-family: Arial;
                font-size: 14px;
            }
            a {
                color: blue;
                text-decoration: none;
                font-size: 14px;
            }
            a:hover
            {
                text-decoration: underline;
            }
        </style>
    </head>
    <script type="text/javascript">             
        function agregar_doc1(){             
            var panel2 = document.getElementById("text1_modal1");             
            var panel3 = document.getElementById("text2_modal1");             
            var panel4 = document.getElementById("text3_modal1");             
            var panel5 = document.getElementById("text4_modal1");              
            var panel6 = document.getElementById("text5_modal1");              
            var panel7 = document.getElementById("text6_modal1");             
            var panel8 = document.getElementById("text7_modal1");          
            var text1=(panel2.value || panel2.options[panel2.selectedIndex].value);          
            var text2=panel3.value;           
            var text3=panel4.value;           
            var text4=panel5.value;           
            var text5=panel6.value;           
            var text6=panel7.value; alert(text6);          
            var text7=panel8.value;           
            var pa=1;          
            $.ajax({               
                url: 'http://localhost/~patricio/acad/admin.php/pagotodos/add_doc',             
                type: 'POST',               
                async: true,              
                data: 'p1=' + text1 + '&p2=' + text2 + '&p3=' + text3 + '&p4=' + text4 + '&p5=' + text5 + '&p6=' + text6 + '&p7=' + text7 + '&pa=' +1,
                processData: true,              
                dataType: 'html',                  
                success: (function(data) {                        
                    document.getElementById("tablaDoc1").html(data) ;                   
                })         
            });         
        }             
            function elimina_fila_tabla(nro,panel){             v
                ar pa=panel;             
                var nomb_pa="tablaDoc"+pa;             
                var nomb_txt="text0_modal"+pa;          
                $.ajax({               
                    url: 'http://localhost/~patricio/acad/admin.php/pagotodos/elim_fila_doc',             
                    type: 'POST',               
                    async: true,              
                    data: 'fila='+nro + '&pa=' + pa,              
                    processData: true,              
                    dataType: 'html',                  
                    success: (function(data) {                        
                        document.getElementById(nomb_pa).html(data) ;                       
                        document.getElementById("pago_i1").value=document.getElementById("idvalortotdoc").value;                      
                        document.getElementById(nomb_txt).value=document.getElementById("idnrodocredito").value;                   
                    })         
                });         
            }
        </script>
    <body>
        <div>
            <a href='<?php echo site_url('examples/customers_management') ?>'>Customers</a> |
            <a href='<?php echo site_url('examples/orders_management') ?>'>Orders</a> |
            <a href='<?php echo site_url('examples/products_management') ?>'>Products</a> |
            <a href='<?php echo site_url('examples/offices_management') ?>'>Offices</a> | 
            <a href='<?php echo site_url('examples/employees_management') ?>'>Employees</a> |		 
            <a href='<?php echo site_url('examples/film_management') ?>'>Films</a>
        </div>
        <div style='height:20px;'></div>  
        <div>
            <?php echo $output; ?>
        </div>
        
    <div id="modal1" class="modal hide fade in" style="display: none;">                       
        <div class="modal-header">                            
            <a data-dismiss="modal" class="close">×</a>                            
            <h3>CREAR NUEVO DOCUMENTO</h3>                         
        </div>                         
        <div class="modal-body">                        
            <div class="control-group">                            
                <label class="control-label" for="input01">NRO. DOC</label>                            
                <div class="controls">                                
                    <input type="text" readonly="True" class="input-medium span1" id="text0_modal1" name="num_modal" value="" >                            
                </div>                        
            </div>                        
            <div class="control-group">                            
                <label class="control-label" for="input01">NOMBRE DEL BANCO</label>                            
                <div class="controls">                                
                    <input type="text" class="input-medium span2" id="text1_modal1" name="nom_doc_pago_mat_modal" value="" >                            
                </div>                        
            </div>                        
            <div class="control-group">                            
                <label class="control-label" for="input02">NRO DEL CHEQUE</label>                            
                <div class="controls">                                
                    <input type="text" class="input-medium span2"   id="text2_modal1" name="nro_comp_pago_mat_modal" value="" >  
                </div>                       
            </div>                        
            <input type="hidden" name="lote_doc_pago_mat2" value="NINGUNO">                        
            <div class="control-group">                            
                <label class="control-label" for="input03">REFERENTE</label>                            
                <div class="controls">                                
                    <input type="text" class="input-medium span2"   id="text3_modal1" name="ref_doc_pago_mat_modal" value="" >                            
                </div>                        
            </div>                     
            <div class="control-group">                         
                <label class="control-label" for="input03">MONTO DEL CHEQUE</label>                         
                <div class="controls">                             
                    <input type="number" step="0.01" class="input-medium span1"   id="text4_modal1"name="monto_rest_doc_pago_modal" value="0" >                         
                </div>                     
            </div>                        
            <input type="hidden" id="text5_modal1"name="monto_efec_doc_pago_modal" value="0">                        
            <input type="hidden" id="text6_modal1"name="fechadep_doc_pago_mat_modal" value="0">                        
            <input type="hidden" id="text7_modal1"name="lote_doc_pago_mat_modal" value="0">                     
        </div>                        
        <div class="modal-footer">                                
            <div class="controls">                                     
                <a data-dismiss="modal" class="close" onclick="agregar_doc1()">Agregar</a>                                 
            </div>                          
        </div>                    
    </div>                            
    <div class="control-group">
    <div class="controls">
        <a data-toggle="modal" href="#modal1" class="btn btn-primary">Varios Cheque</a>
    </div>
    </div>        
            
    </body>
    
         <script type="text/javascript">';
        function agregar_doc(panel){';

        var panel2 = document.getElementById("text1_modal" + $panel);
        var panel3 = document.getElementById("text2_modal" + $panel );
        
        var panel4 = document.getElementById("text3_modal" + $panel );
        var panel5 = document.getElementById("text4_modal" + $panel);
        var panel6 = document.getElementById("text5_modal" + $panel);
        if (panel==2){
            var panel7 = document.getElementById("datepicker6");
        }elseif(panel==4){
            var panel7 = document.getElementById("datepicker7");
        }else{
           var panel7 = document.getElementById("text6_modal" + $panel);
        }
        
        var panel8 = document.getElementById("text7_modal".+ $panel);

        var text1=(panel2.value || panel2.options[panel2.selectedIndex].value);
        //$out.='             alert(' . $panel . ');';

        var text2=panel3.value;
        var text3=panel4.value;
        var text4=panel5.value;
        var text5=panel6.value;
        var text6=panel7.value; alert(text6);
        var text7=panel8.value;
        var pa=panel;

        

        $.ajax({
        url: '" . base_url() . "admin.php/pagotodos/add_doc',
        type: 'POST', 
        async: true,
        data: 'p1=' + text1 + '&p2=' + text2 + '&p3=' + text3 + '&p4=' + text4 + '&p5=' + text5 + '&p6=' + text6 + '&p7=' + text7 + '&pa=' +pa,
        processData: true,
        dataType: 'html',
        success: (function(data) { 
        //alert(data);
        document.getElementById("tablaDoc"+ panel).html(data) ;
        //$out.='                      document.getElementById("pago_i1").value=document.getElementById("idvalortotdoc").value;';
        //$out.='                      document.getElementById("text0_modal' . $panel . '").value=document.getElementById("idnrodocredito").value; ';


            })
            });

        
        }
        
        function elimina_fila_tabla(nro,panel){';
            var pa=panel;
            var nomb_pa="tablaDoc"+pa;
            var nomb_txt="text0_modal"+pa;
        $.ajax({
        url: '" . base_url() . "admin.php/pagotodos/elim_fila_doc',
        type: 'POST',
        async: true,';
        data: 'fila='+nro + '&pa=' + pa,
//        $out.="              data: 'p1=' + text1 ,";

        processData: true,
        dataType: 'html',
        success: (function(data) {  
        //alert(data);
        document.getElementById(nomb_pa).html(data) ; ';
        //$out.='                      document.getElementById("pago_i1").value=document.getElementById("idvalortotdoc").value;';
        //$out.='                      document.getElementById(nomb_txt).value=document.getElementById("idnrodocredito").value; ';


        })

        });

        //fin switch
        }

        </script>
    
</html>
